<?php get_instance()->view('common/header');?>
<body>
    <div class="orderxq chuizhi">
        <a href="<?php echo getUrl('product/merchant?merchant_id='.$info['merchant_id'])?>">
            <div class="maxuserimg"><img src="<?php echo $info['shop_icon']?>" alt=""></div>
        </a>
        <div class="f13 mt5"><?php echo $info['status_desc']?></div>
        <p class="cor6 f09"><?php echo $info['tips']?></p>

        <div class="heng vCenter mt5">
            <?php if($info['status'] == 1):?>
                <!-- 待支付-->
                <a alert-message="确定是否取消订单？" href="<?php echo getUrl("order/orderCancel?order_id=".$info['id'])?>" class="weui-btn_mini borbtn widbtn cbtn ajax-request-btn">取消订单</a>
                <a href="<?php echo getUrl('product/orderPay?code='.$info['code'])?>" class="weui-btn_mini borbtn hbtn ml5">立即支付(还剩<span class="f10 ml5 timespan" id="timer"><b class="f11"></b>小时<b class="f11"></b>分钟</span>)</a>
            <?php elseif ($info['status'] == 2):?>
                <!-- 待接单-->
                <a alert-message="确定是否立即提醒商家接单？" href="<?php echo getUrl('order/push?order_id='.$info['id'])?>" class="ajax-request-btn weui-btn_mini borbtn hbtn ml5">催一下</a>
                <a alert-message="确定是否取消订单？" href="<?php echo getUrl("order/orderCancel?order_id=".$info['id'])?>" class="weui-btn_mini borbtn widbtn cbtn ajax-request-btn">取消订单</a>
            <?php elseif ($info['status'] == 4):?>
                <!-- 待评价-->
                <?php if ($info['after_sale'] == 1):?>
                <a href="<?php echo getUrl('order/saveService?order_id='.$info['id'])?>" class="weui-btn_mini borbtn hbtn ml5">申请售后</a>
               <?php endif;?>
                <a href="" class="weui-btn_mini borbtn hbtn ml5">立即评价</a>
            <?php elseif ($info['status'] == 5):?>
                <!-- 已完成-->
                <a alert-message="确定是否删除订单？" href="<?php echo getUrl("order/orderRemove?order_id=".$info['id'])?>"  class="ajax-request-btn weui-btn_mini borbtn widbtn cbtn">删除订单</a>
                <a href="<?php echo getUrl('product/merchant?merchant_id='.$info['merchant_id'])?>" class="weui-btn_mini borbtn hbtn ml5">再次消费</a>
            <?php elseif ($info['status'] == 7):?>
                <!-- 交易关闭-->
                <a alert-message="确定是否删除订单？" href="<?php echo getUrl("order/orderRemove?order_id=".$info['id'])?>" class="ajax-request-btn weui-btn_mini borbtn widbtn cbtn">删除订单</a>
            <?php endif;?>
        </div>

    </div>
    <?php if($info['expense_type'] == 2):?>
    <a href="javascript:;" class="f12 waper bor_tt heng vCenter itemitem itemitembtn">
        <div class="left f08 vCenter"><span class="f09"><img class="lefttitleimg mr5 di mbmin" src="<?php echo $this->staticUrl?>img/png/pic25.png" alt="">核销认证</span><span class="f09 cor9 ml10">请将二维码、核销码提供给商家</span></div>
        <div class="right f09 cor6 vCenter"><div class="rightjbox imgbox f08 ml5"><img class="rightj" src="<?php echo $this->staticUrl?>img/png/pic21.png" alt=""></div></div>
    </a>
    <div class="itemitembox-cons chuizhi">
        <div class="imgbox"><img src="<?php echo $info['verification_bar_code']?>" alt=""></div>
        <p class="m10_0"><?php echo $info['verification_code']?></p>
    </div>
    <?php endif;?>
    <div class="f12 waper bor_bt heng vCenter itemitem">
        <div class="left f08 vCenter"><span class="f09"><img class="lefttitleimg mr5 di mbmin" src="<?php echo $this->staticUrl?>img/png/pic23.png" alt="">商品信息</span></div>
    </div>
    <div class="weui-panel__bd bor_bb pt5">
        <?php foreach ($product as $v):?>
        <div class="p3 mb5">
            <a href="javascript:void(0);" class="weui-media-box_appmsg ">
                <div class="weui-media-box__bd">
                    <h4 class="weui-media-box__title lh10 textEll f08 mb5"><?php echo $v['name'];?></h4>
                    <p class="f07 cor9"><?php echo $v['property'];?></p>
                </div>
                <div class="">
                    <p class="f08"><?php echo $v['price'];?></p>
                    <b class="f07 cor9 lh10">x<?php echo $v['quantity'];?></b>
                </div>
            </a>
        </div>
        <?php endforeach;?>
    </div>
    <?php if($info['remark']):?>
    <div class="listnobor">
        <div class="listnobor-item hengleft">
            <span class="cor6 left">用户备注</span>
            <span class="cor0 right"><?php echo $info['remark'];?></span>
        </div>
    </div>
    <?php endif;?>
    <div class="weui-cells mt0">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <p style="font-size: 13px;color: #888888;">配送费</p>
            </div>
            <div class="weui-cell__ft f08 cor3">¥<?php echo $info['shipping_fee'];?></div>
        </div>
        <?php if(!empty($info['param']['active'])):?>
            <div class="weui-cell dk">
                <?php foreach ($info['param']['active'] as $v):?>
                    <div class="heng mb5">
                        <div class="weui-cell__bd">
                            <p style="font-size: 13px;color: #888888;"><?php echo $v['key']?></p>
                        </div>
                        <div class="weui-cell__ft f08 cor3"><?php echo $v['value']?></div>
                    </div>
                <?php endforeach;?>
            </div>
        <?php endif;?>
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <p style="font-size: 13px;color: #888888; " class="f08">总计¥<?php echo $info['param']['reality_amount']?></p>
            </div>
            <div class="weui-cell__ft f08 cor3">实付<span class="hongzi ml5">¥<?php echo $info['param']['reality_amount']?></span></div>
        </div>
    </div>
    <div class="f12 waper bor_bb heng vCenter itemitem">
        <div class="left f08 vCenter"><span class="f09"><img class="lefttitleimg mr5 di mbmin" src="<?php echo $this->staticUrl?>img/png/pic25.png" alt="">配送信息</span></div>
    </div>
    <div class="listnobor">
        <div class="listnobor-item hengleft">
            <span class="cor6 left">送达时间</span>
            <span class="cor0 right"><?php echo $info['delivery']['arrivetime']?></span>
        </div>
        <div class="listnobor-item hengleft">
            <span class="cor6 left">联系人</span>
            <span class="cor0 right"><?php echo $info['delivery']['contacts']?> <?php echo $info['delivery']['gender']?> <?php echo $info['delivery']['mobile']?></span>
        </div>
        <div class="listnobor-item hengleft">
            <span class="cor6 left">配送地址</span>
            <span class="cor0 right"><?php echo $info['delivery']['address']?></span>
        </div>
        <div class="listnobor-item hengleft">
            <span class="cor6 left">配送服务</span>
            <span class="cor0 right"><?php if($info['shipping_type'] == 1):?>商家配送<?php else:?> 平台配送<?php endif;?></span>
        </div>
        <?php if(!empty($info['delivery']['delivery_name'])):  ?>
            <div class="heng vCenter">
                <div class="hengleft pt5">
                    <div class="minuserimg imgbox"><img src="<?php echo $info['delivery']['delivery_portrait'] ?>" alt=""></div>
                    <div class="">
                        <h1 class="vCenter lh10 mbmin">
                            <?php echo $info['delivery']['delivery_name']?>
                            <img class="ml5 heightimg" src="<?php echo $this->staticUrl?>/img/png/pic677.png" alt="">
                        </h1>
                        <p class="f09"><?php echo $info['delivery']['delivery_mobile']?></p>
                    </div>
                </div>
                <div>
                    <div class="vCenter">
                        <a href="tel:<?php echo $info['delivery']['delivery_mobile']?>" class="borbtnPub f09 mr10 cbtn">电话</a>
                        <?php if($info['status'] == 4):?>
                            <a href="<?php echo getUrl('order/getOrderExpress?order_id='.$info['id'])?>" class="borbtnPub f09 szzz">查看</a>
                        <?php endif;?>
                    </div>
                </div>
            </div>
        <?php endif;  ?>
    </div>
    <div class="f12 waper bor_bt heng vCenter itemitem">
        <div class="left f08 vCenter"><span class="f09"><img class="lefttitleimg mr5 di mbmin" src="<?php echo $this->staticUrl?>img/png/pic25.png" alt="">订单信息</span></div>
    </div>
    <div class="listnobor orderbottom-listnobor">
        <div class="listnobor-item hengleft">
            <span class="cor6 left">订单号</span>
            <span class="cor0 right"><?php echo $info['order']['code']?></span>
        </div>
        <div class="listnobor-item hengleft">
            <span class="cor6 left">下单时间</span>
            <span class="cor0 right"><?php echo $info['order']['addtime']?></span>
        </div>
        <div class="listnobor-item hengleft">
            <span class="cor6 left">支付方式</span>
            <span class="cor0 right"><?php echo $info['order']['pay_type']?></span>
        </div>
    </div>
    <div class="pb50"></div>
    <?php if($info['expense_type'] == 2):?>
        <div class="orderfixed">
            <div class="vCenter">
                <div class="imgbox"><img src="<?php echo $this->staticUrl?>img/png/pic121.png" alt=""></div>
                <div class="fonts">
                    <p class="cor0"><?php echo $info['shop_name']?></p>
                    <p class="cor6 f08"><?php echo $info['shop_address']?></p>
                </div>
            </div>
            <div class="right vCenter">
                <a href="<?php echo getUrl('common/merchantMap?shop_name='.$info['shop_name'].'&mobile='.
                    $info['merchant_mobile'].'&lat='.$info['latitude'].'&lng='.$info['longitude'])?>" class="imgbox dk">
                    <img src="<?php echo $this->staticUrl?>img/png/pic122.png" alt="">
                </a>
                <a href="tel:<?php echo $info['merchant_mobile'];?>" class="imgbox dk"><img src="<?php echo $this->staticUrl?>img/png/pic123.png" alt=""></a>
            </div>
        </div>
    <?php endif;?>
</body>
<script src="<?php echo $this->staticUrl?>js/base.js"></script>
<script>
    //倒计时
    setInterval(function () {
        var addTime = '<?php echo $info['order']['addtime']?>';
        var dateTime =new Date(Date.parse(addTime.replace(/-/g,"/")));//下单时间
        var leftTime =  new Date().getTime() -  dateTime.getTime();
        leftTime = 30*60*1000  - leftTime;
        var minute =parseInt(leftTime/1000/60%60,10);
        var second = parseInt(leftTime/1000%60,10);
        var min = checkTime(minute);
        var sec = checkTime(second);
        $(".timespan").html('<b class="f11">'+min+'</b>分<b class="f11">'+sec+'</b>秒');
        if(leftTime < 1000){
            clearInterval(interval);
        }
    }, 1000);
    function checkTime(i){
        if(i < 10 ){
            i = "0" + i;
        }
        return i;
    }
    $('.push').click(function () {
        var orderid = $(this).attr('orderid');
        $.ajax({
            url: '<?php echo getUrl("order/push")?>',
            type:"POST",
            data:{
                order_id:orderid
            },
            success:function(arr){
                show_message({status:arr.status, message:arr.message});
                return false;
            },
            dataType:'json'
        });
    });

</script>
</html>